<template>
  <div class="main-header">
    <div class="menu-icon" @click="changeFold">
      <el-icon size="20">
        <Expand v-if="isFold" />
        <Fold v-else />
      </el-icon>
    </div>
    <div class="header-content">
      <div>
        <header-nav />
      </div>
      <div>
        <BaseInfo />
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import BaseInfo from './childs/base-info.vue';
import HeaderNav from './childs/header-nav.vue';
import { ref } from 'vue';

const isFold = ref(false);
const emit = defineEmits(['changeFold'])
function changeFold() {
  isFold.value = !isFold.value;

  // 将事件和状态传递给父组件
  emit('changeFold', isFold.value)
}
</script>
<style lang="less" scoped>
.main-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  flex: 1;

  .menu-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
  }

  .header-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
  }
}
</style>
